{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# 4.2 分类函数" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.2.1 MLPClassifier\n", "\n", "MLPClassifier(hidden_layer_sizes =(100,),activation ='relu',solver ='adam',alpha = 0.0001,batch_size ='auto',learning_rate ='constant',learning_rate_init = 0.001,power_t = 0.5,max_iter = 200,shuffle = True,random_state = None,tol = 0.0001,verbose = False,warm_start = False,momentum = 0.9,nesterovs_momentum = True,early_stopping = False,validation_fraction = 0.1,beta_1 = 0.9,beta_2 = 0.999,epsilon = 1e-08 )\n", "\n", "参数解释(Parameters):\n", "\n", " hidden_layer_sizes : tuple, length = n_layers - 2, default (100,) #第i个元素表示第i个隐藏层中的神经元数量\n", " activation : {‘identity’, ‘logistic’, ‘tanh’, ‘relu’}, default ‘relu’ #隐藏层的激活函数\n", " solver : {‘lbfgs’, ‘sgd’, ‘adam’}, default ‘adam’ #权重优化的求解器\n", " learning_rate : {‘constant’, ‘invscaling’, ‘adaptive’}, default ‘constant’#学习率\n", " max_iter:int,optional,default 200 #最大迭代次数\n", " early_stopping : bool, default False #当验证评分没有改善时,是否使用提前停止来终止培训\n", "\n", "属性(Attributes):\n", " \n", " classes_ : array or list of array of shape (n_classes,) #每个输出的类标签\n", " loss_ : float #使用损失函数计算的当前损失\n", " coefs_ : list, length n_layers - 1 #列表中的第i个元素表示对应于层i的权重矩阵\n", " intercepts_ : list, length n_layers - 1 #列表中的第i个元素表示对应于层i + 1的偏置矢量\n", " n_iter_ : int, #求解器运行的迭代次数\n", " n_layers_ : int #层数\n", " n_outputs_ : int #输出个数\n", " out_activation_ : string #输出激活功能的名称\n", " \n", "方法(Methods):\n", "\n", " fit(X,y)\t #使模型适合数据矩阵X和目标y。\n", " get_params([deep])\t #获取此估算工具的参数。\n", " predict(X)\t #预测使用多层感知器分类器\n", " predict_log_proba(X)\t #返回概率估计的对数。\n", " predict_proba(X)\t #概率估计。\n", " score(X,y [,sample_weight])\t#返回给定测试数据和标签的平均准确度。\n", " set_params(** PARAMS)\t #设置此估算器的参数。" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 4.2.2 SVC\n", "\n", "SVC(C=1.0, kernel='rbf', degree=3, gamma='auto', coef0=0.0, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=-1, decision_function_shape='ovr', random_state=None)\n", "\n", "参数解释(Parameters):\n", "\n", " C : float, optional (default=1.0) # 惩罚参数C.\n", " kernel : string, optional (default=’rbf’) # 指定要在算法中使用的内核类型\n", " degree : int, optional (default=3) # 多项式核函数的次数('poly')被所有其他内核忽略\n", " gamma : float, optional (default=’auto’) # 'rbf','poly'和'sigmoid'的核系数\n", " \n", "属性(Attributes):\n", "\n", " support_ : array-like, shape = [n_SV] # 支持向量指数\n", " support_vectors_:array-like,shape = [n_SV,n_features] # 支持向量\n", " n_support_:array-like,dtype = int32,shape = [n_class] # 每个类的支持向量数。\n", " dual_coef_:array,shape = [n_class-1,n_SV] # 决策函数中支持向量的系数\n", " coef_:array,shape = [n_class-1,n_features] # 赋予特征的权重(原始问题中的系数)这仅适用于线性内核\n", " intercept_:array,shape = [n_class *(n_class-1)/ 2] # 决策函数中的常量\n", " \n", "方法(Methods):\n", "\n", " decision_function(X)\t #样品X到分离超平面的距离。\n", " fit(X,y [,sample_weight])\t#根据给定的训练数据拟合SVM模型。\n", " get_params([deep])\t #获取此估算工具的参数。\n", " predict(X)\t #对X中的样本进行分类。\n", " score(X,y [,sample_weight])\t#返回给定测试数据和标签的平均准确度。\n", " set_params(** PARAMS)\t #设置此估算器的参数。" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }